package WinterFlower.work0720;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Scanner;

/**
 * @author ZJM
 * @version 1.0
 * @since 2022-07-20 20:27:52
 */
public class SetTest {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一串字符：");
        String str = sc.nextLine();

        char []chars = str.toCharArray();

        HashMap<Character,Integer> hashMap = new LinkedHashMap<Character, Integer>();

        for(char ch : chars){
            if(!hashMap.containsKey(ch)){//空
                hashMap.put(ch,1);
            }else{
                hashMap.put(ch,hashMap.get(ch)+1);
            }

        }

        for(Character key : hashMap.keySet()){
            System.out.println(key+"="+hashMap.get(key));
        }
    }
}
